import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class StoreCredit {
	private static Item[] parseItem(String[] l) {
		Item r[] = new Item[l.length];
		for(int i = 0; i < l.length; i++)
			r[i] = new Item(i + 1, Integer.parseInt(l[i]));
		return r;
	}
	private static class Item implements Comparable<Item> {
		int index, P;
		public Item(int index, int P) {
			this.index = index;
			this.P = P;
		}
		@Override
		public int compareTo(Item item) {
			return P - item.P;
		}
	}
	public static void main(String[] args) throws IOException {
		BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
		try {
			int N = Integer.parseInt(rdr.readLine());
			for(int n = 1; n <= N; n++) {
				int C = Integer.parseInt(rdr.readLine());
				Integer.parseInt(rdr.readLine());
				Item item[] = parseItem(rdr.readLine().split(" "));
				Arrays.sort(item);
				int l = 0, h = item.length - 1;
				while(l < h && item[l].P + item[h].P != C) {
					if(item[l].P + item[h].P < C)
						l++;
					else
						h--;
				}
				System.out.println("Case #" + n + ": " + Math.min(item[l].index, item[h].index) + " " + Math.max(item[l].index, item[h].index));
			}
		} finally {
			rdr.close();
		}
	}
}
